<!DOCTYPE html>
<html  xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="Cache-Control" content="no-cache,must-revalidate">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta name="format-detection" content="telephone=no, address=no">
    <meta content="yes" name="apple-mobile-web-app-capable">
    <meta content="black-translucent" name="apple-mobile-web-app-status-bar-style">
    <title></title>
    <!-- 引入 jQuery Mobile 样式 -->
    <link rel="stylesheet" href="http://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.css">
    <!-- 引入 jQuery 库 -->
    <script src="http://apps.bdimg.com/libs/jquery/1.10.2/jquery.min.js"></script>
    <!-- 引入 jQuery Mobile 库 -->
    <script src="http://apps.bdimg.com/libs/jquerymobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>



    <script type="text/javascript">


        $(function () {
           $.ajax({
               type:"GET",
               url:"[[@{/meetingType/loadMeetingType}]]",
               success:function (msg) {
                    var appendHtml="<option value='0'>请选择</option>";
                    for (var i=0;i<msg.length;i++){
                        appendHtml+="<option value="+msg[i].id+">"+msg[i].name+"</option>";
                    }
                    $("#tid").append(appendHtml);
               }
           })


        });








        function showPubDiv() {
            $("#two_line").css("border-top", "5px solid #4E90C7");
            //$("#two_tab").css("color","#777777");
            $("#one_line").css("border-top", "5px solid white");
            //$("#one_tab").css("color","white");
            $("#two").css("display", "none");
            $("#one").css("display", "block");
        }

        function showMyMeetings() {

            $("#two_line").css("border-top", "5px solid white");
            $("#one_line").css("border-top", "5px solid #4E90C7");

            $("#one").css("display", "none");
            $("#two").css("display", "block");

            $("#two").empty();

            var uid=$("#uid").val();
            $.ajax({
                type:"post",
                url:"[[@{/meetingPub/uid}]]",
                data:{"uid":uid},
                success:function(msg){
                    if(msg.code==2000){
                        var dataObj=msg.data;


                        var appendHtml = "<font style='padding: 10px 10px 10px 15px;display: block;color: #777777;'>您共发布了"+dataObj.length+"场会议</font>";

                        for(var i=0;i<dataObj.length;i++){

                            var mname=dataObj[i].ptitle;
                            var typeName=dataObj[i].meetingType.name;
                            var pcode=dataObj[i].pcode;

                            appendHtml += "<div style='width: 100%;background-color: white;margin-top: -3px;padding:10px 10px 10px 15px;display: inline-block;'>" +
                                "<div style='width: 70%;float: left;' onclick='showMeetingInfo(\"" + 1 + "\");'>" +
                                "<div style='white-space: nowrap;overflow: hidden;text-overflow:ellipsis;display: block;font-size:18px;'>" +
                                mname + "</div>" +
                                "<div style='white-space: nowrap;overflow: hidden;text-overflow:ellipsis;display: block;color: #777777;font-size:16px;padding-top:1px'>" +
                                typeName + " / " + pcode + "</div></div>" +
                                "<div style='width: 30%;float: right;'>" +
                                "<button class='able-btn' >选择讲者</button></div></div>";
                        }
                        $("#two").append(appendHtml);
                    }
                }
            });
        }
        //会议发布
        function subMeetingPub(){

            //输入的参数非空校验+正则校验
            var ptitle=$("#ptitle").val();
            if(ptitle.length<1){
                alert("会议主题不能为空");
                return;
            }
            var ptime=$("#ptime").val();
            if(ptime.length<1){
                alert("会议召开日期输入不完整");
                return;
            }
            var remark=$("#remark").val();
            if(remark.length<1){
                alert("请描写备注信息");
                return;
            }
            var tid=$("#tid").val();
            if(tid=="0"){
                alert("请选择指定课题类别");
                return;
            }

            var dataObj=$("#pubForm").serialize();
            $.ajax({
                url:"[[@{/meetingPub/add}]]",
                type:"post",
                data:dataObj,
                success:function (msg) {
                    alert("会议发单成功");
                    $("#ptitle").val("");
                    $("#ptime").val("");
                    $("#remark").val("");
                }
            })



        }

    </script>
</head>
<body>

<div data-role="page" id="pageDetail">
    <div style="padding:0px;background-color: #4E90C7;width: 100%;height:40px;line-height:40px;font-size:18px;text-align: center;cursor: pointer;" data-role="none">
        <div style="width: 50%;float: left;color: white;" onclick="showPubDiv();" id="one_tab">
            发布
            <div style="border-right: 1px solid white;float: right;margin-top: 10px;height: 20px;"></div>
        </div>
        <div style="width: 50%;float: left;color: white;" onclick="showMyMeetings();" id="two_tab">我的会议</div>
        <div style="border-top:5px solid white;width: 50%;float: left;" id="one_line"></div>
        <div style="border-top:5px solid #4E90C7;width: 50%;float: left;" id="two_line"></div>
    </div>
    <div id="one" class="ui-body-d ui-content" style="padding:0;display: block;width: 100%;">
        <font style="padding:10px 10px 10px 15px;display: block;color: #777777;">请填写会议相关信息</font>
        <div style="width: 100%;background-color: white;padding:10px 0 10px 0;">

            <form id="pubForm" method="post">
                <input type="hidden" name="uid" id="uid" th:value="${uid}"/>
                <div style="padding-right:15px;padding-left:15px">
                    <label for="ptitle" class="font-label">会议名称:</label>
                    <input name="ptitle" id="ptitle" placeholder="请输入会议名称" ></input>
                </div>
                <div  style="padding-right:15px;padding-left:15px">
                    <label for="ptime" class="font-label">会议日期</label>
                    <input type="datetime-local" name="ptime" id="ptime" />
                </div>
                <div style="padding-right:15px;padding-left:15px">
                    <label for="tid" class="font-label">类别：</label>
                    <select name="tid" id="tid">

                    </select>
                </div>
                <div style="padding-right:15px;padding-left:15px">
                    <label for="pzone" class="font-label">需求讲者区域：</label>
                    <select name="pzone" id="pzone">
                        <option value="全国">全国</option>
                        <option value="东区">东区</option>
                        <option value="西区">西区</option>
                        <option value="南区">南区</option>
                        <option value="北区">北区</option>
                    </select>
                </div>
                <div style="padding-right:15px;padding-left:15px">
                    <label for="remark" class="font-label">备注(选填，100字以内)</label>
                    <textarea name="remark" id="remark" placeholder="请输入会议备注" maxlength="100" class="font-blue input-lightblue" style="box-shadow: none;"></textarea>
                </div>
                <div style="padding-right:15px;padding-left:15px">
                    <input type="button" value="发布会议"  onclick="subMeetingPub()" id="btnId" />
                </div>
            </form>
        </div>
    </div>





    <div id="two" class="ui-body-d ui-content" style="padding: 0;display: none;width: 100%;">

    </div>
</body>

</html>